import time

# 使用普通函数装饰
def my_decorator(func):
    def wrapper():
        print("wrapper函数开始")
        start_time = time.perf_counter()
        func()
        end_time = time.perf_counter()
        print(f"函数执行时间为：{end_time-start_time}")
        print("wrapper函数结束")
    return wrapper

@my_decorator
def for_loop():
    print("for_loop函数开始")
    for i in range(1000000):
        pass
    print("for_loop函数结束")

# new_for = my_decorator(for_loop)
# new_for()

for_loop()